package com.qimei.onerice.service.impl;

import com.qimei.onerice.dao.AdminDao;
import com.qimei.onerice.dao.CustomerDao;
import com.qimei.onerice.dao.impl.AdminDaoImpl;
import com.qimei.onerice.dao.impl.CustomerDaoImpl;
import com.qimei.onerice.entity.Admin;
import com.qimei.onerice.entity.Customer;
import com.qimei.onerice.service.CustomerService;

import java.util.List;

public class CustomerServiceImpl implements CustomerService {
	CustomerDao customerDao = new CustomerDaoImpl();
	@Override
	public Customer customerLogin(String username, String password) {
		return customerDao.customerLogin(username, password);
	}

	@Override
	public List<Customer> getCustomerList() {
		return customerDao.getAllCustomers();
	}

	@Override
	public boolean deleteCustomer(int customerId) {
		int result = customerDao.deleteCustomer(customerId);
		return result > 0;
	}

	@Override
	public boolean updateCustomer(Customer customer) {
		int result = customerDao.updateCustomer(customer);
		return result > 0;
	}

	@Override
	public boolean addCustomer(Customer customer) {
		int result = customerDao.addCustomer(customer);
		return result > 0;
	}

	@Override
	public boolean isCustomerExists(String username, String contact, String email) {
		return false;
	}

	@Override
	public Customer getCustomerById(int customerId) {
		return customerDao.getCustomerById(customerId);
	}
}
